home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / sta_num / sta_num < prev   
Text File  |  1996-07-10  |  2KB  |  70 lines

  1. TO: EVERYONE
  2. FROM: JAMES BLAIR NAN495
  3. DATE: 01/12/87
  4. SUBJECT: MAKING UNIQUE FILES NAMES IN CLIPPER FOR NetWare 286
  5.  
  6. To the extenda.asm utility add: PUBLIC STATION just under public
  7. isprinter.
  8. then under isprinter endp add:
  9.  
  10. ;----------------------------------------------------------------------
  11. ;STATION()
  12. ;SYNTAX: STATION()
  13. ;RETURN: Station number of user PC on NetWare 286
  14.  
  15. STATION PROC FAR
  16.  
  17.          MOV     AH,220    ;station function (my assembler wouldn't
  18.                            ;work with DCh)
  19.          INT     21h       ;get station number
  20.          MOV     AH,0      ;set leading digits to zero
  21.  
  22. RET_STATION:
  23.          PUSH    AX        ;put station where clipper can find it
  24.          CALL    _RETNI    ;return station number
  25.          POP     AX        ;restore the stack
  26.  
  27.          RET               ;all done
  28.  
  29. STATION ENDP               ;goodbye
  30.  
  31. ;------------------------------------------
  32. ;below this are the three existing lines
  33. ;------------------------------------------
  34.  
  35. _PROG ENDS
  36.  
  37.          END
  38.  
  39. ;EOF Extenda.asm-----------------------------------
  40.  
  41. There's a problem with the result as all the leading zeros are suppresed
  42. plus the fact that 4 digits are returned instead of three.  We handle
  43. this with a little extra code;
  44.  
  45. When your application starts:
  46.  
  47. public number
  48. NUMBER=STR(STATION(),4,0)
  49. IF SUBSTR(NUMBER,2,1)=" "
  50.   IF SUBSTR(NUMBER,3,1)=" "
  51.     NUMBER="00"+SUBSTR(NUMBER,4,1)
  52.   ELSE
  53.     NUMBER="0"+SUBSTR(NUMBER,3,2)
  54.   ENDIF
  55. ELSE
  56.   NUMBER=SUBSTR(NUMBER,2,3)
  57. ENDIF
  58. NWFILE="TEMP"+NUMBER && the portion in quotes cannot exceed 5 characters
  59. use nwfile
  60. zap
  61. use
  62.  
  63. The last three lines insure that you get rid of any left over garbage
  64. from whatever cause, when you get to where you need this file just
  65. enter;
  66.  
  67. use nwfile
  68.  
  69. You will have created a file called temp001 or temp002 or temp whatever
  70. station you happen to be all the way to temp255.